class LimitList < ApplicationRecord
  last_trade_date = $TusharePro.tushare_pro("trade_cal", "exchange": "SSE", "start_date": (Time.now - 10.day).strftime("%Y%m%d"), "end_date": (Time.now).strftime("%Y%m%d")).select { |sse| sse["is_open"] == 1 }.first
  last_cal_date = Date.parse(last_trade_date["cal_date"]).strftime("%Y-%m-%d")
  last_pretrade_date = Date.parse(last_trade_date["pretrade_date"]).strftime("%Y-%m-%d")
  scope :last_cal_date, -> { where(trade_date: last_cal_date)}
  scope :last_pretrade_date, -> { where(trade_date: last_pretrade_date)}
  def self.ransackable_attributes(auth_object = nil)
    ["amount", "close", "created_at", "fd_amount", "first_time", "float_mv", "id", "industry", "last_time", "limit", "limit_amount", "limit_times", "name", "open_times", "pct_chg", "reason", "total_mv", "trade_date", "ts_code", "turnover_ratio", "up_stat", "updated_at", "year_count"]
  end
  def self.ransackable_associations(auth_object = nil)
    []
  end

end
